#!/usr/bin/env python

def collatz(num):
    count = 1
    n = num
    while n != 1:
        if n % 2 == 0:
            n = n / 2
        else:
            n = 3 * n + 1
        count = count + 1
    return count

if __name__ == "__main__":
    for n in xrange(1, 1000001):
        print n, ' ', collatz(n)   
